<?php
namespace app\serveradv\service\adv;
use app\manage\service\ApiBase;
/**
 * Created by PhpStorm.
 * User: 97606
 * Date: 2017/7/15
 * Time: 16:38
 */
class Adv extends ApiBase
{
    protected $advLogic = 'app\serveradv\logic\Adv';
    protected $advValidate = 'app\serveradv\validate\Adv';

    //添加广告位
    public function addAdv()
    {
        $data = $this->issetReceiveData(['c_id' => 0, 'name' => ' ', 'description' => '',
            'pic_id' => '', 'relative_path' => '', 'absolute_path' => '', 'jump_url' => '',
            'add_user_id' => ' ', 'auditor_id' => '', 'status' => 1, 'order' => 0, 'start_time' => '',
            'end_time' => '', 'audit_status' => 0]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advAdd','addAdv');
    }

    //编辑广告位
    public function editAdv()
    {
        $data = $this->issetReceiveData(['id' => ' ','c_id' => '', 'name' => '', 'description' => '',
            'pic_id' => '', 'relative_path' => '', 'absolute_path' => '', 'jump_url' => '',
            'add_user_id' => '', 'auditor_id' => '', 'status' => '', 'order' => '', 'start_time' => '',
            'end_time' => '', 'audit_status' => '']);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advEdit','editAdv');
    }

    // 获取广告详情
    public function advinfo()
    {
        $data = $this->haveIssetReceiveData(["id" => " "]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advInfo','deleteAdv');
    }

    //删除广告位
    public function deleteAdv()
    {
        $data = $this->haveIssetReceiveData(["id" => " "]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advDelete','deleteAdv');
    }

    //启用广告位
    public function enableAdv()
    {
        $data = $this->haveIssetReceiveData(["id" => " "]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advEnable','enableAdv');
    }

    //禁用广告位
    public function disableAdv()
    {
        $data = $this->haveIssetReceiveData(["id" => " "]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advDisable','disableAdv');
    }

    //审核通过广告位
    public function advAudit()
    {
        $data = $this->haveIssetReceiveData(["id" => " ", "auditor_id" => ""]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advAudit','advAudit');
    }

    //审核失败/不通过某个广告位
    public function advAuditFailure()
    {
        $data = $this->haveIssetReceiveData(["id" => " ", "auditor_id" => ""]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advAuditFailure','advAuditFailure');
    }

    //某一类广告位列表获取
    public function advClassList()
    {
        $data = $this->haveIssetReceiveData(["c_id" => "", "listRows" => "15", "page" => "1"]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advClassList','advClassList');
    }

    //不同状态广告位列表获取
    public function advDifferenceStatus()
    {
        $data = $this->haveIssetReceiveData(["audit_status" => "1", "listRows" => "15", "page" => "1"]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advDifferenceStatus','advDifferenceStatus');
    }

    //全部广告位列表获取
    public function advList()
    {
        $data = $this->haveIssetReceiveData(['listRows'=>'15', 'page'=>'1']);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advList','advList');
    }

    //规定上架时间内 正常状态 审核通过的广告位等
    public function advTimeLimit()
    {
        $data = $this->haveIssetReceiveData(['c_id'=>'','limit'=>5]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdv/advTimeLimit','advTimeLimit');
    }
}